package top.xunfong.file.constant;


import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum BreakpointUploadMenu {

    CREATE("0", "创建"),
    CHUNK("1", "分片上传"),
    COMPLETE("2", "完成"),
    ;


    private String code;
    private String desc;


    /**
     * 根据code获取枚举对象
     *
     * @param code code值
     * @return 对应的枚举对象，如果未找到则返回null
     */

    public static BreakpointUploadMenu getBreakpointUploadMenuByCode(String code) {
        for (BreakpointUploadMenu menu : BreakpointUploadMenu.values()) {
            if (menu.code.equals(code)) {
                return menu;
            }
        }
        return null;
    }
}